< previous page page_619 next page >

Page 619
0619-01.jpg
Figure 15.12.
The results of a simple 
DELETE statement.
The SQLVB08.SQV script in Listing 15.11 creates a database with one table in it, populates that table with test data, and then shows the loaded table. Next, a DELETE statement is executed to remove all records that have a Table1.RecType that contains LOCAL. When this is done, the results are shown on-screen.
You can create any type of WHERE clause you need to establish the proper criteria. For example, what if you want to remove all international (INTL) records where the last payment is after 12/31/95? Edit your copy of SQLVB08.SQV. Then save and run it to check your results against Figure 15.13. Our version of the solution appears in Listing 15.12.
Type.gifListing 15.12. Using a complex WHERE clause with a DELETE statement.
//
// sqlvb08.sqv - Testing DELETE statements
//
// create a new database
dbMake sqlvb08.mdb;
// create a table to work with
CREATE TABLE Table1
   (RecID TEXT(10),
    LastName TEXT(30),
    FirstName TEXT(30),
    RecType TEXT(5),
    Amount CURRENCY,
    LastPaid DATE
continues

 
< previous page page_619 next page >

If you like this book, buy it!